# 长度为8-10的用户密码（以字母开头，包含字母，数字，下划线）

import re
import string


def password(pass_word):
    if not pass_word[0] in string.ascii_uppercase:
        return "密码未以大写字母开头！"
    # elif not re.search(r'\d' and r'\w' and '_', password):
    #     return "密码不符合规范！"
    elif not re.search(r'\d', pass_word):
        return "密码未含数字！"
    elif not re.search(r'\w', pass_word):
        return "密码未含字母！"
    elif not re.search('_', pass_word):
        return "密码未含下画线！"
    return "密码符合规范！"


print(password("A156asd_asd"))

def passwd(pass_wd):
    error = {}
    result = []
    for i in pass_wd:
        if not i[0] in string.ascii_uppercase:
            error[i] = "密码未以大写字母开头！"
        # elif not re.search(r'\d' and r'\w' and '_', i):
        #     return "密码不符合规范！"
        elif not re.search(r'\d', i):
            error[i] = "密码未含数字！"
        elif not re.search(r'\w', i):
            error[i] = "密码未含字母！"
        elif not re.search('_', i):
            error[i] = "密码未含下画线！"
        else:
            result.append(i)
        return f"合格密码为：{result}", error.items()


print(passwd(["A123_asd", "asd_1345", "Aas_d", "Aasd13"])[0])

